#pragma once
#include "GameWindow.h"


class CGameWindowMgr
{
public:
	CGameWindowMgr(void);
	~CGameWindowMgr(void);

	void Update();
	void Draw();

	void AddWindow(const CGameWindow* pkWnd);
	void DelWindow(const string& rkName);
	void MoveWindowToTop(const string& rkName);
	void SetWndBeforeWnd(const string& rkName,const string& rkOtherName);
	void SetWndAfterWnd(const string& rkName,const string& rkOtherName);
	const CGameWindow* GetWindow(const string& rkName)const;
	CGameWindow* GetWindow(const string& rkName);
	bool IsWndToBeRemoved(CGameWindow* pkWnd);
	bool IsExistWnd(const string& rkName);

	void ProcessUIMsg(UINT uiMessage,WPARAM wParam,LPARAM lParam);
	void SendMsgToWnd(const string& rkWndName,const string& rkMsg,const string& rkData,const string& rkSrcWndName = "");

	void SetMoveChildInfo(CGameWindow* pkChild,int iX = 0,int iY = 0);
	void AddSelectChild(CGameWindow* pkChild);
	void ClearSelectChild();

	bool ProcMoveMultiChilds();	

protected:
	void DelAllWindow();

	void LeftAlign();
	void RightAlign();
	void TopAlign();
	void BottonAlign();	

private:
	vector<CGameWindow*> m_apkWindows;
	map<string,INT64> m_akWndDelFrameIndex;
	INT64 m_kCurFrameCount;

	CGameWindow* m_pkCurMoveChild;
	POINT m_kMoveChildInfo;

	vector<CGameWindow*> m_apkSelectChilds;
	bool m_bMoveMultiChilds;	
};
